package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.ComplaintReportDataTemp;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ComplaintReportDataTempRepository extends PagingAndSortingRepository<ComplaintReportDataTemp, Long>
        , QueryDslPredicateExecutor<ComplaintReportDataTemp> {

    @Query("from ComplaintReportDataTemp where complaint_report_id=:tempId and question_id=:questionId and deleted=false and enabled=true")
    ComplaintReportDataTemp selectDataTemp(@Param("tempId") Long tempId, @Param("questionId") Long questionId);


    @Query("from ComplaintReportDataTemp where complaint_report_id=:tempId and deleted=false and enabled=true")
    List<ComplaintReportDataTemp> selectAnswer(@Param("tempId") Long tempId);

}
